<ion-view view-title="指数宝" >
    <ion-nav-buttons side="left" >
        <back-button></back-button>
        <a ng-href="#/tab/search" class="btnSearch"></a>
    </ion-nav-buttons>
    <ion-content scroll-to-top="1" delegate-handle="scroller" ng-class="{'has-loading': isOffline}">

        <ion-refresher pulling-text={{PULLING_TEXT}} pulling-icon="" refreshing-text={{REFRESHING_TEXT}}
                       on-refresh="doRefresh()"></ion-refresher>

        <!-- promo -->
        <input type="hidden" ng-model="channel.title" value="399300" keep-current-value/>
        <input type="hidden" ng-model="channel.adId" value="4614" keep-current-value/>

        <channel-img ng-click="showAds(true)"></channel-img>

        <div class="tab clearfix">
            <ul>
                <li ng-repeat="channel in channels" ng-class="{current: vm.activeTab == channel.id}" style="width:50%">
                    <em ng-click="vm.activeTab= channel.id">{{channel.catalog_name}}</em></li>
            </ul>
        </div>
        <!-- unlimited -->
        <div class="unlimited">
            <!-- idx -->
            <div class="idx on index_tab" ng-show="vm.activeTab == channels[0].id">
                <dl>
                    <dt>&nbsp;</dt>
                    <dd>
                        <h2>沪深300指数</h2>
                        <div class="increase">
                            <p ng-if="index.price_increase_year">近一年涨幅<em ng-class="{inc_: index.price_increase_year < 0}">{{index.price_increase_year | defNumber :2 : '%'}}</em></p>
                            <p ng-if="!index.price_increase_year"><em class="inc_"></em></p>
                            <p ng-if="index.price_increase_month6">近半年涨幅<em ng-class="{inc_: index.price_increase_month6 < 0}">{{index.price_increase_month6 | defNumber :2 : '%'}}</em></p>
                            <p ng-if="!index.price_increase_month6"><em class="inc_"></em></p>
                        </div>
                    </dd>
                </dl>
                <div class="retract">收起</div>
                <!-- chart -->
                <div class="chart">
                    <!--<div class="mask"></div>-->
                    <time id="data_date">沪深300指数走势更新日期：{{data_date}}</time>
                    <highchart config="csi300ChartConfig"></highchart>
                </div>
                <!-- related -->
                <div class="term">
                    <div class="hd">相关基金</div>
                    <div class="panel" ng-repeat="item in channels[0].funds">
                        <a href="#/tab/product-item-QDII/{{item.prod_code}}?is_index=1">
                            <h2 class="item">{{item.prod_name | defString}}<sup ng-if="item.prod_attr_ext_info.prod_plate">{{item.prod_attr_ext_info.prod_plate}}</sup></h2>
                            <div class="item">
                                <p ng-if="item.prod_status!=4" class="increase">近一年涨幅<em ng-class="{inc_: item.price_increase_year < 0}">{{item.price_increase_year | defNumber :2 : '%'}}</em></p>
                                <p ng-if="item.prod_status==4" class="increase">认购截止日<em>{{item.ipo_end_date | defDateString}}</em></p>
                                <p>单位净值<em>{{item.prod_nav | defNumber : 4}}<sub>元</sub></em></p>
                                <p>起购金额<em ng-bind-html="item.prod_min_subscribe"></em></p>
                            </div>
                        </a>
                    </div>
                </div>
            </div>
        </div>
        <div class="index_tab" ng-show="vm.activeTab == channels[1].id">
            <div class="term">
                <div class="panel" ng-repeat="item in channels[1].funds">
                    <a href="#/tab/product-item-QDII/{{item.prod_code}}?is_index=1">
                        <h2 class="item">{{item.prod_name | defString}}<sup ng-if="item.prod_attr_ext_info.prod_plate">{{item.prod_attr_ext_info.prod_plate}}</sup></h2>
                        <div class="item">
                            <p ng-if="item.prod_status!=4" class="increase">近一年涨幅<em ng-class="{inc_: item.price_increase_year < 0}">{{item.price_increase_year | defNumber :2 : '%'}}</em></p>
                            <p ng-if="item.prod_status==4" class="increase">认购截止日<em>{{item.ipo_end_date | defDateString}}</em></p>
                            <p>单位净值<em>{{item.prod_nav | defNumber : 4}}<sub>元</sub></em></p>
                            <p>起购金额<em ng-bind-html="item.prod_min_subscribe"></em></p>
                        </div>
                    </a>
                </div>
            </div>
        </div>
    </ion-content>
    <scroll-to-top-button animate="true">
        <a class="backTop">↑</a>
    </scroll-to-top-button>
</ion-view>